
format ELF64 executable 3

segment readable executable

entry $
    mov	eax, 85         ; sys_creat
    mov	edi, filename
    mov esi, 110000000b ; user has read write permission
    syscall
    mov [filedesc], eax

    mov eax, 1
    mov edi, [filedesc]
    mov esi, header
    mov edx, headersize
    syscall

    mov eax, 1
    mov edi, [filedesc]
    mov esi, pixels
    mov edx, pixelssize
    syscall

    mov	eax, 60 ; sys_exit
    mov	edi, 0  ; exit code
    syscall

segment readable writeable

filename db 'img.tga', 0
filedesc dd ?
header db 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 4, 0, 32, 0
headersize = $ - header
pixels db 4 * 4 * 4 dup 255
pixelssize = $ - pixels
